<template>
  <a-tree-select
    :tree-data="$store.state.taxCalculate.cityTreeSelectOption"
    treeNodeFilterProp="title"
    show-search
    tree-checkable
    :replaceFields="replaceFields"
    placeholder="请选择"
    v-model="dataVal"
    @change="onChange"
  />
</template>
<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      dataVal: [],
      replaceFields: {
        children: "children",
        key: "id",
        value: "code",
        title: "name"
      }
    };
  },
  watch: {
    visible(v) {
      if (v) {
        this.dataVal = [];
      }
    }
  },
  methods: {
    onChange(value, selectedOptions) {
      this.$emit("upDate", value);
    }
  }
};
</script>
